{{include file='../templates/sub/00_start.tpl'}}
{{include file='../sys/01_notice.tpl'}}
{{include file='../sys/02_script.tpl'}}
{{include file='../templates/sub/01_head.tpl'}}
{{$navindex="deal"}}
{{include file='../templates/sub/02_nav.tpl'}}
<div class="gird_24 dpage">
    <div class="dcontent" style="padding: 28px 0">
        <div class="dbr5" style="position: relative;min-height: 400px;background: rgb(247,247,247);-webkit-box-shadow:  0px 0px 6px #000;-moz-box-shadow:  0px 0px 6px #000;box-shadow:  0px 0px 6px #000;">
            <div style="padding:20px 0 20px 20px;position: relative">
                <div class="dmenutwo">
                    <div style="float: left">
                        <a href="{{base_url()}}danh-muc/tat-ca"><div class="item {{if $data["CategoryIndex"]=="tat-ca"}}active{{/if}}">Tất cả</div></a>
                        {{foreach $data["oCategorys"] as $ca}}
                            <a href="{{base_url()}}danh-muc/{{$ca->Alias}}">
                                <div class="item {{if $ca->Alias==$data["CategoryIndex"]}}active{{/if}}">
                                    {{$ca->Name}}
                                </div>
                            </a>
                        {{/foreach}}
                    </div>
                </div>
                {{if count($data["oProduct"])>0}}
                <div class="dgroup dbig" style="margin-top: 20px">
                    {{for $d=0 to 1}}
                    {{if isset($data["oProduct"][$d])}}
                        <div class="ditem {{if $d%2==0}}dl{{else}}dr{{/if}}">
                            <div class="dphoto">
                                <img class="lazy" src="{{$data["oProduct"][$d]["Image"]}}" />
                            {{if $data["oProduct"][$d]["Discontinued"]==1}}<div class="sold-out"></div>{{/if}}
                                <a href="{{base_url()}}san-pham/{{$data["oProduct"][$d]["Alias"]}}">
                                    <div class="ho50">
                                        <div class="dship">
                                            Giao sản phẩm
                                        </div>
                                        <div class="dview"></div>
                                    </div>
                                </a>
                                <div class="ddisc">-{{number_format(($data["oProduct"][$d]["UnitPrice"]-$data["oProduct"][$d]["UnitsOnOrder"])*100/$data["oProduct"][$d]["UnitPrice"],0)}}%</div>

                            </div>
                            <div class="dtit">
                                <a href="{{base_url()}}san-pham/{{$data["oProduct"][$d]["Alias"]}}">
                                    <h1>
                                        {{$data["oProduct"][$d]["ProductName"]}}
                                    </h1>
                                </a>
                            </div>
                            <div class="dprice">
                                <div class="dsale">
                                    <div>
                                        {{number_format($data["oProduct"][$d]["UnitsOnOrder"], 0, ',', '.')}}<sup style="font-size:20px;">đ</sup>
                                    </div>
                                </div>
                                <div class="dunitprice">
                                    <span class="sf">Trị giá</span><br/>
                                    <span class="ss">{{number_format($data["oProduct"][$d]["UnitPrice"], 0, ',', '.')}}<sup style="font-size:12px;">đ</sup></span>
                                </div>
                            </div>
                            <div class="df_time_view">
                                <div class="dtime">
                                    <b>{{round((strtotime($data["oProduct"][$d]["EndDate"])-strtotime("now"))/(60*60*24))}}</b> ngày 
                                    <b>{{round( ((strtotime($data["oProduct"][$d]["EndDate"])-strtotime("now"))%(60*60*24))/(60*60) )}}</b> giờ 
                                    <b>{{round( (((strtotime($data["oProduct"][$d]["EndDate"])-strtotime("now"))%(60*60*24))%(60*60))/60 )}}</b> phút

                                </div>
                                <div class="hidden" style="position:absolute;top:0px;right :20px;padding-right:0px;line-height:40px;font-size:14px;text-align:center">
                                    <b>{{$data["oProduct"][$d]["Sold"]+$data["oProduct"][$d]["ReorderLevel"]}}</b> người đã mua
                                </div>
                            </div>
                        </div>
                    {{/if}}
                    {{/for}}

                </div>
                <div class="clear"></div>
                {{for $foo=2 to count($data["oProduct"])-1 step 3}}
                    <div class="dgroup dsmall">
                        {{for $dsi=$foo to $foo+2 step 1}}
                        {{if isset($data["oProduct"][$dsi]["ProductName"])}}
                            <div class="ditem d{{$dsi-$foo}}">
                                <div class="dphoto">
                                    <img class="lazy" data-original="{{$data["oProduct"][$dsi]["Image"]}}"/>
                                {{if $data["oProduct"][$dsi]["Discontinued"]==1}}<div class="sold-out"></div>{{/if}}
                                <a href="{{base_url()}}san-pham/{{$data["oProduct"][$dsi]["Alias"]}}">
                                    <div class="ho50">
                                        <div class="dship">
                                            Giao sản phẩm
                                        </div>
                                        <div class="dview"></div>
                                    </div>
                                </a>
                                <div class="ddisc">-{{number_format(($data["oProduct"][$dsi]["UnitPrice"]-$data["oProduct"][$dsi]["UnitsOnOrder"])*100/$data["oProduct"][$dsi]["UnitPrice"],0)}}%</div>

                            </div>
                            <div class="dtit">
                                <a href="{{base_url()}}san-pham/{{$data["oProduct"][$dsi]["Alias"]}}">
                                    <h1>
                                        {{$data["oProduct"][$dsi]["ProductName"]}}
                                    </h1>
                                </a>
                            </div>
                            <div class="dprice">
                                <div class="dsale">
                                    <div>
                                        {{number_format($data["oProduct"][$dsi]["UnitsOnOrder"], 0, ',', '.')}}<sup style="font-size:12px;">đ</sup>
                                    </div>
                                </div>
                                <div class="dunitprice">
                                    <span class="sf">Trị giá</span><br/>
                                    <span class="ss">{{number_format($data["oProduct"][$dsi]["UnitPrice"], 0, ',', '.')}}<sup style="font-size:12px;">đ</sup></span>
                                </div>
                            </div>
                            <div class="df_time_view">
                                <div class="dtime">
                                    <b>{{round((strtotime($data["oProduct"][$dsi]["EndDate"])-strtotime("now"))/(60*60*24))}}</b> ngày 
                                    <b>{{round( ((strtotime($data["oProduct"][$dsi]["EndDate"])-strtotime("now"))%(60*60*24))/(60*60) )}}</b> giờ 
                                    <b>{{round( (((strtotime($data["oProduct"][$dsi]["EndDate"])-strtotime("now"))%(60*60*24))%(60*60))/60 )}}</b> phút
                                </div>
                                <div class="dview-user hidden">
                                    <b>{{$data["oProduct"][$dsi]["Sold"]+$data["oProduct"][$dsi]["ReorderLevel"]}}</b> người đã mua
                                </div>
                            </div>
                        </div>
                    {{/if}}
                    {{/for}}
                    </div>
                    <div class="clear"></div>
                {{/for}}
                {{else}}
                    Không tìm thấy sản phẩm nào.
                {{/if}}
                <div style="text-align: right;height: 40px;padding-right: 20px">
                    {{if round($data["Pages"])>0}}
                    {{for $i=0 to round($data["Pages"]) step 1}}
                    <a href="{{base_url()}}danh-muc/{{$data["CategoryIndex"]}}/{{$i+1}}" 
                    style="border: 1px solid #ccc;background: #blue;padding: 3px 8px;text-decoration: none;
                    margin-left: 4px;{{if $data["Page"]==$i+1}};font-weight:bold;background: #2A92B3;color:#fff;{{/if}}">
                        {{$i+1}}
                    </a>
                    {{/for}}
                    {{/if}}
                </div>
        
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("img.lazy").lazyload();
    });
</script>
{{include file='../templates/sub/03_foot.tpl'}}
{{include file='../templates/sub/00_end.tpl'}}